home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 26.zip / BS1 part 26 / Aztec C v5.2a disk 4.adf / 204inc_h.lzh / exec / lists.h < prev    next >
C/C++ Source or Header  |  1991-03-14  |  1KB  |  60 lines

  1. #ifndef EXEC_LISTS_H
  2. #define EXEC_LISTS_H
  3. /*
  4. **    $Filename: exec/lists.h $
  5. **    $Release: 2.04 $
  6. **    $Revision: 36.9 $
  7. **    $Date: 91/02/19 $
  8. **
  9. **    Definitions and macros for use with Exec lists
  10. **
  11. **    (C) Copyright 1985,1986,1987,1988,1989,1991 Commodore-Amiga, Inc.
  12. **        All Rights Reserved
  13. */
  14.  
  15. #ifndef EXEC_NODES_H
  16. #include "exec/nodes.h"
  17. #endif /* EXEC_NODES_H */
  18.  
  19. /*
  20.  *  Full featured list header.
  21.  */
  22. struct List {
  23.    struct  Node *lh_Head;
  24.    struct  Node *lh_Tail;
  25.    struct  Node *lh_TailPred;
  26.    UBYTE   lh_Type;
  27.    UBYTE   l_pad;
  28. };    /* word aligned */
  29.  
  30. /*
  31.  * Minimal List Header - no type checking
  32.  */
  33. struct MinList {
  34.    struct  MinNode *mlh_Head;
  35.    struct  MinNode *mlh_Tail;
  36.    struct  MinNode *mlh_TailPred;
  37. };    /* longword aligned */
  38.  
  39.  
  40. /*
  41.  *    Check for the presence of any nodes on the given list.    These
  42.  *    macros are even safe to use on lists that are modified by other
  43.  *    tasks.    However; if something is simultaneously changing the
  44.  *    list, the result of the test is unpredictable.
  45.  *
  46.  *    Unless you first arbitrated for ownership of the list, you can't
  47.  *    _depend_ on the contents of the list.  Nodes might have been added
  48.  *    or removed during or after the macro executes.
  49.  *
  50.  *        if( IsListEmpty(list) )        printf("List is empty\n");
  51.  */
  52. #define IsListEmpty(x) \
  53.     ( ((x)->lh_TailPred) == (struct Node *)(x) )
  54.  
  55. #define IsMsgPortEmpty(x) \
  56.     ( ((x)->mp_MsgList.lh_TailPred) == (struct Node *)(&(x)->mp_MsgList) )
  57.  
  58.  
  59. #endif    /* EXEC_LISTS_H */
  60.